package 第七周.experiment;

public class Rename1 {
    private final Rename rename;

    public Rename1(Rename rename) {
        this.rename = rename;
    }

    public double getR() {
        return rename.getR();
    }

    public double getI() {
        return rename.getI();
    }

    public boolean equals(Rename a) {
        boolean result = false;
        if (getR() == a.getR() && getI() == a.getI())
            result = true;
        return result;
    }//定义公有方法:加减乘除.

    public Rename ComplexAdd(Rename a) {
        double r = a.getR() + rename.getR();
        double i = a.getI() + rename.getI();
        return new Rename(r, i);
    }

    public Rename ComplexSub(Rename a) {
        double r = rename.getR() - a.getR();
        double i = rename.getI() - a.getI();
        return new Rename(r, i);
    }
}